package com.dom.domweb.modular.controller;

import com.dom.domweb.model.MenuTree;
import com.dom.domweb.modular.service.IndexService;
import com.dom.domweb.modular.shiro.model.ShiroUser;
import com.dom.domweb.modular.shiro.util.ShiroUtil;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author xllei
 * @Date 2018/11/19 10:40 AM
 * @Version 1.0
 **/
@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private IndexService indexService;

    @RequestMapping(value = "/loadMenu", method = RequestMethod.POST)
    public MenuTree loadMenu(){
        ShiroUser user = ShiroUtil.getUser();

        return indexService.loadUserMenu(user);
    }

    @RequestMapping(value = "loadNavMenu", method = RequestMethod.POST)
    public MenuTree loadNavMenu(){
        ShiroUser user = ShiroUtil.getUser();

        return indexService.loadNavMenu(user);
    }
}
